# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=py3-tqdm
pkgver=4.66.4
pkgrel=0
pkgdesc="Fast, Extensible Progress Meter"
url="https://pypi.org/project/tqdm"
arch="noarch"
license="MIT"
makedepends="
	py3-gpep517
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-pandas
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-timeout
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/t/tqdm/tqdm-$pkgver.tar.gz"
builddir="$srcdir/tqdm-$pkgver"

replaces="py-tqdm" # Backwards compatibility
provides="py-tqdm=$pkgver-r$pkgrel" # Backwards compatibility

# secfixes:
#   4.66.4-r0:
#     - CVE-2024-34062

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# 30s timeout
	case "$CARCH" in
	riscv64)
		.testenv/bin/python3 -m pytest \
			--ignore tests/tests_perf.py
		;;
	*)
		.testenv/bin/python3 -m pytest \
			--deselect tests/tests_perf.py::test_lock_args
		;;
	esac
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	ln -s tqdm "$pkgdir"/usr/bin/tqdm-3
}

sha512sums="
fdafa64784564f7f400f29ffa75ba564a3c9bc6d935a1ccd82260d4a1f4431792a9dae2d5c6ed69cc265f078f674081589a040d47b8745a500870d27670feadc  tqdm-4.66.4.tar.gz
"
